<?
	if(isset($_POST['card_num']))
        {
        require_once('anet_php_sdk/AuthorizeNet.php'); 
        $transaction = new AuthorizeNetAIM('9s3WwpFL43', '9n2X7Q933cT7U5fU');
       
        $transaction->amount = $_POST['price'];
        $transaction->card_num = $_POST['card_num'];
        $transaction->exp_date = $_POST['exp_date'];
       
        $response = $transaction->authorizeAndCapture();
        }
        
        if(isset($_POST['totalItem']))
        	$total = ($_POST['totalCPU'] * $_POST['CPUPrice']) + ($_POST['totalVCard'] * $_POST['VCardPrice']) + ($_POST['totalHDD'] * $_POST['HDDPrice']) + ($_POST['totalNetCard'] * $_POST['NetCardPrice']) + ($_POST['totalRAM'] * $_POST['RAMPrice']) + ($_POST['totalMonitor'] * $_POST['MonitorPrice'])
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Home Page</title>
    <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" href="../../Admin/inc/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="e-commmerce.css" />
</head>

<body>
	   <div class="wrapper">
        <div class="container">
            <pre>
                        <?
                                if (isset($response)) {
                                        print_r($response);
                                }
                        ?>
            </pre>
                        	 
           
            <form action="?" method="post">
                Price: <input type="number" name="price" value="<?=$total?>"/> <br />
                Credit Card Number: <input type="text" name="card_num" /> <br />
                Experation Date: <input type="text" name="exp_date" />
                <input type="submit" value="Buy Now" />
            </form>
                </div>
               </div>
</body>
</html>
